<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<%@ include file="/mete.jsp"%>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.2.min.js"></script>
<script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath }/js/My97DatePicker/WdatePicker.js"></script>
<script src='${pageContext.request.contextPath }/js/ajaxfileUpload.js' type='text/javascript'></script>
<script type="text/javascript">
$(function(){
	$("#company_id").val("${model.COMPANY_ID}");
	$("#gasstation_id").val("${model.GASSTATION_ID}");
	$("#status").val("${model.STATUS}");
	$("#descs").val("${model.DESCS}");
})
	
</script>
</script>
<script type="text/javascript">
	function fileChange() {
		ajaxFileUpload();
	}
	function ajaxFileUpload() {
		$.ajaxFileUpload({
			url : '${pageContext.request.contextPath }/file_upload!uploadFileDoc.do',
			type : 'post',
			secureuri : false,
			fileElementId : 'contract',
			dataType : 'JSON',
			success : function(d) {
				var obj = JSON.parse(d);
				if (obj.status == 0) {
					$("#contract_url").val(obj.data.doc_name);
					alert("文件上传成功!");
				}
			}
		});
	}
</script>
</head>
<body>
	<div class="meijieContent">
		<div class="myform app_info">
		<form action="${pageContext.request.contextPath }/contract!update.do" class="form-horizontal n-validator n-yellow" id="frmApp" method="post" role="form">
			<h2>编辑合同</h2>
			<input type="hidden" name="ID" value="${model.ID }">
			<input type="hidden" id="contract_url" name="CONTRACT_URL" value="${model.CONTRACT_URL }">
			<ul>
            <table>
               <tr>
                    <td class="colname"><span class="warn">*</span>公司名称:</td>
                    <td class="content">
                    	<select id="company_id" name="COMPANY_ID" value="${model.COMPANY_ID }">
                    		<option value="">--请--选--择--公--司--</option>
                    		<c:forEach items="${companyList }" var="company">
                    			<option value="${company.ID }">${company.NAME }</option>
                    		</c:forEach>
                    	</select>
                    </td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>网点:</td>
                    <td class="content">
                    	<select id="gasstation_id" name="GASSTATION_ID" value="${model.GASSTATION_ID }">
                    		<option value="">--请--选--择--网--点--</option>
                    		<c:forEach items="${gasstationList }" var="gasstation">
                    			<option value="${gasstation.ID }">${gasstation.NAME }</option>
                    		</c:forEach>
                    	</select>
                    </td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>合同状态:</td>
                    <td class="content">
                    	<select id="status" name="STATUS" value="${model.STATUS }">
                    		<option value="">--请--选--择--</option>
                    		<option value="0">正常</option>
                    		<option value="1">过期</option>
                    	</select>
                    </td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>签订时间:</td>
                    <td class="content"><input class="txt" id="signtime" name="CONTRACT_SIGNTIME" placeholder="请输入签订时间" value="${model.CONTRACT_SIGNTIME }" type="text" onClick="WdatePicker()"/></td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>合同开始时间:</td>
                    <td class="content"><input class="txt" id="startdate" name="CONTRACT_STARTDATE" value="${model.CONTRACT_STARTDATE }" placeholder="请输入开始时间" type="text" onClick="WdatePicker()"/></td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>合同截止时间:</td>
                    <td class="content"><input class="txt" id="enddate" name="CONTRACT_ENDDATE" value="${model.CONTRACT_ENDDATE }" placeholder="请输入截止时间" type="text" onClick="WdatePicker()"/></td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>合同简介:</td>
                    <td class="content">
                    	<textarea rows="3" cols="31" id="descs" name="DESCS" value="${model.DESCS }"></textarea>
                    </td>
               </tr>
               <tr>
                    <td class="colname"><span class="warn">*</span>上传合同:</td>
                    <td class="content"><input id="contract" onchange="fileChange()" type="file" name='file'/></td>
               </tr>
               <tr>
                    <td class="submit" colspan="2" align="center">
                    	<input class="submit" type="submit" value="保  存"/>
					</td>
               </tr>
            </table>
		</ul>
	</form>
	</div>
	</div>
</body>

</html>
